export default {
	namespaced:true,
	state:()=>({
		cartList:[
			{
			    goodsNum:0,
                goodsTotalPrice: 0,
                shop_id: 153348,
                shop_name: "自营超市",
                shop_checked:true,
                goodsDetailsList:[
                    {
                    common_id: 52768,
                    goods_id: 142842,
                    goods_image: "https://fkgou-images.oss-cn-qingdao.aliyuncs.com/fkggoods/shopid%3D153348%26time%3D1565601254908%26id%3D3d2df379-93ae-50ba-5d25-83851e97b16c.jpeg?OSSAccessKeyId=LTAIHv7U1m8yTCrg&Expires=1000001565601255&Signature=lKYwD0if2UZ3pSt5VIo5BjFV2x0%3D",
                    goods_name: "黑鸡谷物蛋来自英国皇室品种贵妃鸡蛋30枚/盒",
                    goods_num: 1,
                    goods_price: 36.5,
                    goods_spec_chineseValue: "30枚/盒",
                    goods_totalPrice: 36.5,
                    shop_id: 153348,
                    is_checked:true
                },
                {
                    common_id: 123835,
                    goods_id: 153002,
                    goods_image: "https://fkgou-images.oss-cn-qingdao.aliyuncs.com/fkggoods/shopid%3D153348%26time%3D1628653434805%26id%3D8f496db6-af76-fa83-e0de-336834e10511.jpeg?OSSAccessKeyId=LTAIHv7U1m8yTCrg&Expires=1000001628653434&Signature=%2B%2FpohDahDwgiy9PkcVrbszI8U1s%3D",
                    goods_name: "贵州茅台白金藏酒5L/瓶酱香型高度白酒",
                    goods_num: 1,
                    goods_price: 28900,
                    goods_spec_chineseValue: "5L/瓶",
                    goods_totalPrice: 28900,
                    shop_id: 153348,
                    is_checked:true
                }
                ]
			},
            {
			    goodsNum:0,
                goodsTotalPrice: 0,
                shop_id: 153348,
                shop_name: "东北特产专区",
                shop_checked:false,
                goodsDetailsList:[
                    {
                        common_id: 117191,
                        goodsId: null,
                        goodsIsShelves: 1,
                        goodsMaxSale: 999,
                        goods_id: 142036,
                        goods_image: "https://fkgou-images.oss-cn-qingdao.aliyuncs.com/fkggoods/shopid%3D159039%26time%3D1629375542639%26id%3Df5cb47fa-986f-a34f-825b-e32e4741ec5d.jpeg?OSSAccessKeyId=LTAIHv7U1m8yTCrg&Expires=1000001629375542&Signature=zt2ib74iMLVxHwi50z9YBKQRTQM%3D",
                        goods_name: "东北特产 吉林大米 鸭田稻圆粒香米5KG 新米 九台贡米 东北大米 包邮",
                        goods_num: 1,
                        goods_price: 49.9,
                        goods_spec: null,
                        goods_spec_chineseValue: "5kg鸭田米",
                        goods_stock: 952,
                        goods_totalPrice: 49.9,
                        shop_id: 159039,
                        is_checked:true
                }
                ]
			},
            {
			    goodsNum:0,
                goodsTotalPrice: 0,
                shop_id: 159038,
                shop_name: "茶友们茶叶旗舰店",
                shop_checked:false,
                goodsDetailsList:[
                    {
                        common_id: 125018,
                        goods_id: 154774,
                        goods_image: "https://fkgou-images.oss-cn-qingdao.aliyuncs.com/fkggoods/shopid%3D159038%26time%3D1630567177061%26id%3De8d3d9fe-6567-f6f1-5b29-735746ec2e59.jpeg?OSSAccessKeyId=LTAIHv7U1m8yTCrg&Expires=1000001630567177&Signature=V7o6frcXPaYNqUP%2FKgV%2BuYGQp2M%3D",
                        goods_name: "茉莉花茶2021新茶龙珠形茶叶浓香型横县花茶绿茶散装/罐装500g",
                        goods_num: 1,
                        goods_price: 168,
                        goods_spec_chineseValue: "500g",
                        goods_totalPrice: 168,
                        shop_id: 159038,
                        is_checked:true
                },
                {
                    common_id: 118362,
                    goodsId: null,
                    goodsIsShelves: 1,
                    goodsMaxSale: 9996,
                    goods_id: 144087,
                    goods_image: "https://fkgou-images.oss-cn-qingdao.aliyuncs.com/fkggoods/shopid%3D159038%26time%3D1608623361232%26id%3D522cb406-ed8a-f239-6acf-e32e3ccf32ad.jpeg?OSSAccessKeyId=LTAIHv7U1m8yTCrg&Expires=1000001608623363&Signature=WfdjqRAgg9UY3ai4odNi8BS6URw%3D",
                    goods_name: "金骏眉红茶礼盒装茶叶一级正宗桐木关红茶散装金俊眉罐装500克",
                    goods_num: 1,
                    goods_price: 198,
                    goods_spec: null,
                    goods_spec_chineseValue: "500g",
                    goods_stock: 9996,
                    goods_totalPrice: 198,
                    shop_id: 159038,
                    is_checked:false
                },
                {
                    common_id: 80601,
                    goodsId: null,
                    goodsIsShelves: 1,
                    goodsMaxSale: 10000,
                    goods_id: 101772,
                    goods_image: "https://fkgou-images.oss-cn-qingdao.aliyuncs.com/fkggoods/shopid%3D159038%26time%3D1584861753810%26id%3D2e986bd9-ef93-e347-d394-7187054fa548.jpeg?OSSAccessKeyId=LTAIHv7U1m8yTCrg&Expires=1000001584861754&Signature=qAuxJqfiq2yzII53rW1KOECEsRs%3D",
                    goods_name: "茶友们 正宗新会小青柑普洱茶熟茶一级柑普茶桔橘普茶叶礼盒装200g",
                    goods_num: 1,
                    goods_price: 39.8,
                    goods_spec: null,
                    goods_spec_chineseValue: "200g",
                    goods_stock: 10000,
                    goods_totalPrice: 39.8,
                    shop_id: 159038,
                    is_checked:true
                }
                ]
			},
            
		]
	}),
	getters: {
		cartInfo(state){
            let allCheck=true
            state.cartList.forEach((val)=>{
                val.goodsDetailsList.forEach(va=>{
                    if(!va.is_checked){
                        allCheck=false
                    }
                })
            })
            
            return {allCheck}
        }
	},
	mutations:{
		CheckComMut(state,{idx,index}){
            console.log(idx,index);  //idx为商品的下标，index为商点的下标
            state.cartList[idx].goodsDetailsList[index].is_checked=!state.cartList[idx].goodsDetailsList[index].is_checked
            // state.cartList[idx].goodsDetailsList.forEach(val=>{
            //     val.for
            // })
        },
        // CheckShopMut(state,index){
        //     // console.log(index); //拿到商店的下标
        // }
	}
}